package eightDataType.bigNum;

import utils.PrintUtil;

import java.math.BigInteger;
import java.util.Iterator;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

/**
 * @Author: Jie
 * @Date: 2019/6/7 12:48
 * @Function :结论，BigInteger 可以超过，Int 最长的10位，
 * treemap 默认对 biginter 升序排列
 */
public class MainClient {
    public static void main(String[] args) {
//        Scanner sin = new Scanner(System.in);
//        BigInteger inbinger = sin.nextBigInteger();
//        System.out.println(inbinger);
        BigInteger b1 = new BigInteger(String.valueOf(111111));
        BigInteger b0 = new BigInteger(String.valueOf(100000));
        BigInteger b2 = new BigInteger(String.valueOf(200000));
        int i = b0.compareTo(b1);
        int i2 = b1.compareTo(b1);
        int i3 = b2.compareTo(b1);
        System.out.println(i +" "+i2 +" "+ i3);

        TreeMap<BigInteger,String> treeMap = new TreeMap<>();
        for (int j = 0; j < 100; j++) {
            BigInteger bigInteger = new BigInteger(String.valueOf("1000000000000" + (j % 5) ));
            treeMap.put(bigInteger,String.valueOf(j));
        }

        Iterator<Map.Entry<BigInteger, String>> iterator = treeMap.entrySet().iterator();

        BigInteger pro = null;
        while (iterator.hasNext()){
            Map.Entry<BigInteger, String> next = iterator.next();
            if (pro != null) {
                boolean b = next.getKey().compareTo(pro) > 0;
                System.out.println(b+" key "+next.getKey()+"  value "+next.getValue());
            }else {
                System.out.println(" key "+next.getKey()+"  value "+next.getValue());
            }
//            System.out.println(" key "+next.getKey()+"  value"+next.getValue());
            pro = next.getKey();
        }



    }
}
